<section class="page-wrap yyxx-box">
    <div class="pay-list-box">
        <div class="bg"></div>
        <ul id="payMode">
            <li class="title">请选择支付方式<i class="close-btn"></i></li>
            <li value="2" class="active">
                <a>
                    <i class="icon-box icon2"></i>
                    <span>支付宝</span>
                    <i class="yes-icon"></i>
                </a>
            </li>
            </li>
           <!--  <li value="0">
                <a>
                    <i class="icon-box icon4"></i>
                    <span>到医院付</span>
                    <i class="yes-icon"></i>
                </a>
            </li> -->
            <li>
                <div class="pay-btn-box">
                    <a class="pay-btn" href="javascript:void(0);">确认支付</a>
                </div>
            </li>
        </ul>
    </div>
</section>
<script>
        $('.close-btn').click(function(){
            StoreCache.removeCache("payInfo");
             var urlInfo = $(".pay-btn").attr("urlInfo");
            if(urlInfo && urlInfo!=""){
                var urlInfo = JSON.parse($(".pay-btn").attr("urlInfo"));
            }
            $('.pay-list-box').hide();
            if(urlInfo && urlInfo.closeUrl!=""){
                $.QuickUrlUtils.redirectJSBridge({url:urlInfo.successUrl});
            }else{
                $('.pay-list-box').hide();
            }
            
        });
       /**确认支付*/
        function toGetPay(parmas){
            var jq = $("#payMode").find(".active[value]");
            var length = $(jq).length;
            if(length == 0){
                $.QuickAlert.alertFail({
                    content : "请选择支付方式！"
                });
            }else{
            $.JkcsUtils.jsbridgeRegister("payEnd", function(params){
                payEnd(params);
            });
                $.QuickRemote.AjaxJson({
                funcName:"/api/gzd/yygh/getOrderId"
                ,callback:function (info) {
                        var orderId = info.orderId;
                        var orgInfo = info.appInfo;
                        var obj = {
                            appid:orgInfo.appid,
                            appSecret:orgInfo.workKey,
                            submerno:info.submerno,
                            channelType:'alipay',
                            goods_desc:'诊间付费',
                            billNum:orderId,
                            order_desc:'挂号费',
                            billTotalFee:1,
                            billTitle:"挂号费"
                        };
                        $.JkcsUtils.nativePermission({
                            "type": "pay",
                            "callBackMethod": "payEnd",
                            "params":obj
                        });
               }
               ,params:parmas});
           }
            function payEnd(data){
                var msg ="";
                if(data.payStateCode==-1){
                      $.QuickAlert.alertNormal("取消预约", {
                        callback: function(){
                          var urlInfo = JSON.parse($(".pay-btn").attr("urlInfo"));
                            if(urlInfo && urlInfo.successUrl!=""){
                                $.QuickUrlUtils.redirectJSBridge({url:urlInfo.successUrl});
                            }else{
                                $.QuickUrlUtils.refreshJSBridge(location.href);
                            }
                        }
                    });
                }else if(data.payStateCode==0){
                      $.QuickAlert.alertNormal("支付失败");
                }else if(data.payStateCode==1){
                     $.QuickAlert.alertNormal("支付成功", {
                        callback: function(){
                          var urlInfo = JSON.parse($(".pay-btn").attr("urlInfo"));
                            if(urlInfo && urlInfo.successUrl!=""){
                                var animate=urlInfo.animate?urlInfo.animate:"";
                                var refreshUrl = animate =="pop"?urlInfo.successUrl:"";
                                $.QuickUrlUtils.redirectJSBridge({url:urlInfo.successUrl,animate:animate,refreshUrl:refreshUrl});
                            }else{
                                $.QuickUrlUtils.refreshJSBridge(location.href);
                            }
                        }
                    });
                    
                }

               
                $('.pay-list-box').hide();
           }
                     
    }
</script>
<style>
.yyxx-box .pay-list-box > ul,.yyxx-box .pay-list-box .bg{
    position:fixed;
}
</style>